package com.handinglian.task.mapper;

import com.handinglian.task.dto.AssignedNumDto;
import com.handinglian.task.dto.CustomerTaskDto;
import com.handinglian.task.entity.TaskUserRelation;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Collection;
import java.util.List;

@Mapper
public interface TaskUserRelationMapper {
    int deleteByPrimaryKey(Integer taskUserId);

    int insert(TaskUserRelation record);

    int insertOrUpdate(TaskUserRelation record);

    int insertOrUpdateSelective(TaskUserRelation record);

    int insertSelective(TaskUserRelation record);

    TaskUserRelation selectByPrimaryKey(Integer taskUserId);

    int updateByPrimaryKeySelective(TaskUserRelation record);

    int updateByPrimaryKey(TaskUserRelation record);

    int updateBatch(List<TaskUserRelation> list);

    int batchInsert(@Param("list") List<TaskUserRelation> list);

    int deleteByTaskId(@Param("taskId") Integer taskId);

    List<TaskUserRelation> find();

    List<TaskUserRelation> findByTaskId(@Param("taskId") Integer taskId);

    List<TaskUserRelation> findByTaskIdAndUserId(@Param("taskId") Integer taskId, @Param("userId") Integer userId);

    List<TaskUserRelation> findByTaskIdInAndUserId(@Param("taskIdCollection") Collection<Integer> taskIdCollection, @Param("userId") Integer userId);

    List<CustomerTaskDto> inquireCustomerTaskList(@Param("userId") Integer userId, @Param("customerPhone") String customerPhone);

    List<AssignedNumDto> inquireAssignedNumList();

    List<TaskUserRelation> findByUserId(@Param("userId") Integer userId);

    List<TaskUserRelation> findByTaskIdIn(@Param("taskIdCollection") Collection<Integer> taskIdCollection);

    int updateValidByUserId(@Param("updatedValid")Integer updatedValid,@Param("userId")Integer userId);

    List<Integer> findDistinctTaskId();

    List<String> findCustomerPhoneByTaskIdAndCustomerPhoneIn(@Param("taskId")Integer taskId,@Param("customerPhoneCollection")Collection<String> customerPhoneCollection);

    List<TaskUserRelation> findByTaskIdAndCustomerPhoneIn(@Param("taskId")Integer taskId,@Param("customerPhoneCollection")Collection<String> customerPhoneCollection);
}